
import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/components/Layout.vue'
const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'Login',
      component: () => import('@/views/Login.vue'),
    },
    {
      path: '/Register',
      name: 'Register',
      component: () => import('@/views/Register.vue'),
    },
    //商品管理
    {
      path: '/goods',
      name: 'Good',
      component: Layout,
      children: [{
        path: 'category',
        name: 'category',
        component: () => import('@/views/goods/category.vue'),
      },
      {
        path: 'list',
        name: 'list',
        component: () => import('@/views/goods/list.vue'),
      },
      {
        path: 'release',
        name: 'release',
        component: () => import('@/views/goods/release.vue'),
      },
      {
        path: 'edit/:id',
        name: 'edit',
        component: () => import('@/views/goods/edit.vue'),
      },
      ]
    },
    // 订单管理
    {
      path: '/order',
      name: 'order',
      component: Layout,
      children: [
        {
          path: 'list',
          name: 'orderList',
          component: () => import('@/views/order/list.vue')
        }
      ]
    },
    //用户管理
    {
      path: '/user',
      name: 'user',
      component: Layout,
      children: [
        {
          path: 'info',
          name: 'info',
          component: () => import('@/views/user/info.vue')
        },
        {
          path: 'list',
          name: 'userList',
          component: () => import('@/views/user/list.vue')
        }
      ]
    },
    //权限设置
    {
      path: '/auth',
      name: 'auth',
      component: Layout,
      children: [
        {
          path: 'menu',
          name: 'authMenu',
          component: () => import('@/views/auth/menu.vue')
        },
        {
          path: 'role',
          name: 'authRole',
          component: () => import('@/views/auth/role.vue')
        }
      ]
    }
  ]
})

export default router
